3.854 \(\int \frac {(A+B \tan (e+f x)) (c+d \tan (e+f x))}{(a+i a \tan (e+f x))^2} \, dx\)

Optimal. Leaf size=104 \[ \frac {A (d+i c)+B (c+3 i d)}{4 a^2 f (1+i \tan (e+f x))}+\frac {x (A-i B) (c-i d)}{4 a^2}+\frac {(-B+i A) (c+i d)}{4 f (a+i a \tan (e+f x))^2} \]

[Out]

1/4*(A-I*B)*(c-I*d)*x/a^2+1/4*(B*(c+3*I*d)+A*(I*c+d))/a^2/f/(1+I*tan(f*x+e))+1/4*(I*A-B)*(c+I*d)/f/(a+I*a*tan(
f*x+e))^2

________________________________________________________________________________________

Rubi [A]  time = 0.24, antiderivative size = 104, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 36, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.083, Rules used = {3590, 3526, 8} \[ \frac {A (d+i c)+B (c+3 i d)}{4 a^2 f (1+i \tan (e+f x))}+\frac {x (A-i B) (c-i d)}{4 a^2}+\frac {(-B+i A) (c+i d)}{4 f (a+i a \tan (e+f x))^2} \]

Antiderivative was successfully verified.

[In]

Int[((A + B*Tan[e + f*x])*(c + d*Tan[e + f*x]))/(a + I*a*Tan[e + f*x])^2,x]

[Out]

((A - I*B)*(c - I*d)*x)/(4*a^2) + (B*(c + (3*I)*d) + A*(I*c + d))/(4*a^2*f*(1 + I*Tan[e + f*x])) + ((I*A - B)*
(c + I*d))/(4*f*(a + I*a*Tan[e + f*x])^2)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3526

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> -Simp[((
b*c - a*d)*(a + b*Tan[e + f*x])^m)/(2*a*f*m), x] + Dist[(b*c + a*d)/(2*a*b), Int[(a + b*Tan[e + f*x])^(m + 1),
 x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && LtQ[m, 0]

Rule 3590

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_
.) + (f_.)*(x_)]), x_Symbol] :> -Simp[((A*b - a*B)*(a*c + b*d)*(a + b*Tan[e + f*x])^m)/(2*a^2*f*m), x] + Dist[
1/(2*a*b), Int[(a + b*Tan[e + f*x])^(m + 1)*Simp[A*b*c + a*B*c + a*A*d + b*B*d + 2*a*B*d*Tan[e + f*x], x], x],
 x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a*d, 0] && LtQ[m, -1] && EqQ[a^2 + b^2, 0]

Rubi steps

\begin {align*} \int \frac {(A+B \tan (e+f x)) (c+d \tan (e+f x))}{(a+i a \tan (e+f x))^2} \, dx &=\frac {(i A-B) (c+i d)}{4 f (a+i a \tan (e+f x))^2}-\frac {i \int \frac {a (B (c+i d)+A (i c+d))+2 a B d \tan (e+f x)}{a+i a \tan (e+f x)} \, dx}{2 a^2}\\ &=\frac {B (c+3 i d)+A (i c+d)}{4 a^2 f (1+i \tan (e+f x))}+\frac {(i A-B) (c+i d)}{4 f (a+i a \tan (e+f x))^2}+\frac {((A-i B) (c-i d)) \int 1 \, dx}{4 a^2}\\ &=\frac {(A-i B) (c-i d) x}{4 a^2}+\frac {B (c+3 i d)+A (i c+d)}{4 a^2 f (1+i \tan (e+f x))}+\frac {(i A-B) (c+i d)}{4 f (a+i a \tan (e+f x))^2}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 1.89, size = 201, normalized size = 1.93 \[ -\frac {(A+B \tan (e+f x)) (c+d \tan (e+f x)) (\sin (2 (e+f x)) (A (4 i c f x+c+4 d f x+i d)+B (4 c f x+i c-4 i d f x-d))+\cos (2 (e+f x)) (A (c (4 f x+i)+d (-1-4 i f x))-B (4 i c f x+c+d (4 f x+i)))+4 i (A c+B d))}{16 a^2 f (\tan (e+f x)-i)^2 (A \cos (e+f x)+B \sin (e+f x)) (c \cos (e+f x)+d \sin (e+f x))} \]

Antiderivative was successfully verified.

[In]

Integrate[((A + B*Tan[e + f*x])*(c + d*Tan[e + f*x]))/(a + I*a*Tan[e + f*x])^2,x]

[Out]

-1/16*(((4*I)*(A*c + B*d) + (A*(d*(-1 - (4*I)*f*x) + c*(I + 4*f*x)) - B*(c + (4*I)*c*f*x + d*(I + 4*f*x)))*Cos
[2*(e + f*x)] + (B*(I*c - d + 4*c*f*x - (4*I)*d*f*x) + A*(c + I*d + (4*I)*c*f*x + 4*d*f*x))*Sin[2*(e + f*x)])*
(A + B*Tan[e + f*x])*(c + d*Tan[e + f*x]))/(a^2*f*(A*Cos[e + f*x] + B*Sin[e + f*x])*(c*Cos[e + f*x] + d*Sin[e
+ f*x])*(-I + Tan[e + f*x])^2)

________________________________________________________________________________________

fricas [A]  time = 0.72, size = 84, normalized size = 0.81 \[ \frac {{\left ({\left (4 \, {\left (A - i \, B\right )} c + {\left (-4 i \, A - 4 \, B\right )} d\right )} f x e^{\left (4 i \, f x + 4 i \, e\right )} + {\left (i \, A - B\right )} c - {\left (A + i \, B\right )} d + {\left (4 i \, A c + 4 i \, B d\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} e^{\left (-4 i \, f x - 4 i \, e\right )}}{16 \, a^{2} f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))*(c+d*tan(f*x+e))/(a+I*a*tan(f*x+e))^2,x, algorithm="fricas")

[Out]

1/16*((4*(A - I*B)*c + (-4*I*A - 4*B)*d)*f*x*e^(4*I*f*x + 4*I*e) + (I*A - B)*c - (A + I*B)*d + (4*I*A*c + 4*I*
B*d)*e^(2*I*f*x + 2*I*e))*e^(-4*I*f*x - 4*I*e)/(a^2*f)

________________________________________________________________________________________

giac [B]  time = 1.74, size = 200, normalized size = 1.92 \[ -\frac {\frac {2 \, {\left (-i \, A c - B c - A d + i \, B d\right )} \log \left (-i \, \tan \left (f x + e\right ) + 1\right )}{a^{2}} + \frac {2 \, {\left (i \, A c + B c + A d - i \, B d\right )} \log \left (-i \, \tan \left (f x + e\right ) - 1\right )}{a^{2}} + \frac {-3 i \, A c \tan \left (f x + e\right )^{2} - 3 \, B c \tan \left (f x + e\right )^{2} - 3 \, A d \tan \left (f x + e\right )^{2} + 3 i \, B d \tan \left (f x + e\right )^{2} - 10 \, A c \tan \left (f x + e\right ) + 10 i \, B c \tan \left (f x + e\right ) + 10 i \, A d \tan \left (f x + e\right ) - 6 \, B d \tan \left (f x + e\right ) + 11 i \, A c + 3 \, B c + 3 \, A d + 5 i \, B d}{a^{2} {\left (\tan \left (f x + e\right ) - i\right )}^{2}}}{16 \, f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))*(c+d*tan(f*x+e))/(a+I*a*tan(f*x+e))^2,x, algorithm="giac")

[Out]

-1/16*(2*(-I*A*c - B*c - A*d + I*B*d)*log(-I*tan(f*x + e) + 1)/a^2 + 2*(I*A*c + B*c + A*d - I*B*d)*log(-I*tan(
f*x + e) - 1)/a^2 + (-3*I*A*c*tan(f*x + e)^2 - 3*B*c*tan(f*x + e)^2 - 3*A*d*tan(f*x + e)^2 + 3*I*B*d*tan(f*x +
 e)^2 - 10*A*c*tan(f*x + e) + 10*I*B*c*tan(f*x + e) + 10*I*A*d*tan(f*x + e) - 6*B*d*tan(f*x + e) + 11*I*A*c +
3*B*c + 3*A*d + 5*I*B*d)/(a^2*(tan(f*x + e) - I)^2))/f

________________________________________________________________________________________

maple [B]  time = 0.26, size = 338, normalized size = 3.25 \[ \frac {A \ln \left (\tan \left (f x +e \right )+i\right ) d}{8 f \,a^{2}}+\frac {B \ln \left (\tan \left (f x +e \right )+i\right ) c}{8 f \,a^{2}}-\frac {i B \ln \left (\tan \left (f x +e \right )+i\right ) d}{8 f \,a^{2}}-\frac {i A c}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )^{2}}-\frac {i A d}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )}+\frac {i \ln \left (\tan \left (f x +e \right )-i\right ) B d}{8 f \,a^{2}}+\frac {c A}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )}+\frac {3 B d}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )}+\frac {A d}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )^{2}}+\frac {B c}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )^{2}}-\frac {i B c}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )}+\frac {i A \ln \left (\tan \left (f x +e \right )+i\right ) c}{8 f \,a^{2}}+\frac {i B d}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )^{2}}-\frac {i \ln \left (\tan \left (f x +e \right )-i\right ) A c}{8 f \,a^{2}}-\frac {\ln \left (\tan \left (f x +e \right )-i\right ) A d}{8 f \,a^{2}}-\frac {\ln \left (\tan \left (f x +e \right )-i\right ) B c}{8 f \,a^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A+B*tan(f*x+e))*(c+d*tan(f*x+e))/(a+I*a*tan(f*x+e))^2,x)

[Out]

1/8/f/a^2*A*ln(tan(f*x+e)+I)*d+1/8/f/a^2*B*ln(tan(f*x+e)+I)*c-1/8*I/f/a^2*B*ln(tan(f*x+e)+I)*d-1/4*I/f/a^2/(ta
n(f*x+e)-I)^2*A*c-1/4*I/f/a^2/(tan(f*x+e)-I)*A*d+1/8*I/f/a^2*ln(tan(f*x+e)-I)*B*d+1/4/f/a^2/(tan(f*x+e)-I)*c*A
+3/4/f/a^2/(tan(f*x+e)-I)*B*d+1/4/f/a^2/(tan(f*x+e)-I)^2*A*d+1/4/f/a^2/(tan(f*x+e)-I)^2*B*c-1/4*I/f/a^2/(tan(f
*x+e)-I)*B*c+1/8*I/f/a^2*A*ln(tan(f*x+e)+I)*c+1/4*I/f/a^2/(tan(f*x+e)-I)^2*B*d-1/8*I/f/a^2*ln(tan(f*x+e)-I)*A*
c-1/8/f/a^2*ln(tan(f*x+e)-I)*A*d-1/8/f/a^2*ln(tan(f*x+e)-I)*B*c

________________________________________________________________________________________

maxima [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: RuntimeError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))*(c+d*tan(f*x+e))/(a+I*a*tan(f*x+e))^2,x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: Error executing code in Maxima: expt: undefined: 0 to a negative e
xponent.

________________________________________________________________________________________

mupad [B]  time = 9.50, size = 159, normalized size = 1.53 \[ -\frac {B\,d\,f\,x-A\,c\,f\,x+A\,d\,f\,x\,1{}\mathrm {i}+B\,c\,f\,x\,1{}\mathrm {i}}{4\,a^2\,f}+\frac {\left (A\,c+3\,B\,d-A\,d\,1{}\mathrm {i}-B\,c\,1{}\mathrm {i}\right )\,{\mathrm {tan}\left (e+f\,x\right )}^3+\left (2\,A\,d+2\,B\,c+B\,d\,4{}\mathrm {i}\right )\,{\mathrm {tan}\left (e+f\,x\right )}^2+\left (3\,A\,c+B\,d+A\,d\,1{}\mathrm {i}+B\,c\,1{}\mathrm {i}\right )\,\mathrm {tan}\left (e+f\,x\right )+A\,c\,2{}\mathrm {i}+B\,d\,2{}\mathrm {i}}{f\,\left (4\,a^2\,{\mathrm {tan}\left (e+f\,x\right )}^4+8\,a^2\,{\mathrm {tan}\left (e+f\,x\right )}^2+4\,a^2\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(((A + B*tan(e + f*x))*(c + d*tan(e + f*x)))/(a + a*tan(e + f*x)*1i)^2,x)

[Out]

(A*c*2i + B*d*2i + tan(e + f*x)*(3*A*c + A*d*1i + B*c*1i + B*d) + tan(e + f*x)^2*(2*A*d + 2*B*c + B*d*4i) + ta
n(e + f*x)^3*(A*c - A*d*1i - B*c*1i + 3*B*d))/(f*(4*a^2 + 8*a^2*tan(e + f*x)^2 + 4*a^2*tan(e + f*x)^4)) - (A*d
*f*x*1i - A*c*f*x + B*c*f*x*1i + B*d*f*x)/(4*a^2*f)

________________________________________________________________________________________

sympy [A]  time = 0.55, size = 298, normalized size = 2.87 \[ \begin {cases} \frac {\left (\left (16 i A a^{2} c f e^{4 i e} + 16 i B a^{2} d f e^{4 i e}\right ) e^{- 2 i f x} + \left (4 i A a^{2} c f e^{2 i e} - 4 A a^{2} d f e^{2 i e} - 4 B a^{2} c f e^{2 i e} - 4 i B a^{2} d f e^{2 i e}\right ) e^{- 4 i f x}\right ) e^{- 6 i e}}{64 a^{4} f^{2}} & \text {for}\: 64 a^{4} f^{2} e^{6 i e} \neq 0 \\x \left (- \frac {A c - i A d - i B c - B d}{4 a^{2}} + \frac {\left (A c e^{4 i e} + 2 A c e^{2 i e} + A c - i A d e^{4 i e} + i A d - i B c e^{4 i e} + i B c - B d e^{4 i e} + 2 B d e^{2 i e} - B d\right ) e^{- 4 i e}}{4 a^{2}}\right ) & \text {otherwise} \end {cases} - \frac {x \left (- A c + i A d + i B c + B d\right )}{4 a^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))*(c+d*tan(f*x+e))/(a+I*a*tan(f*x+e))**2,x)

[Out]

Piecewise((((16*I*A*a**2*c*f*exp(4*I*e) + 16*I*B*a**2*d*f*exp(4*I*e))*exp(-2*I*f*x) + (4*I*A*a**2*c*f*exp(2*I*
e) - 4*A*a**2*d*f*exp(2*I*e) - 4*B*a**2*c*f*exp(2*I*e) - 4*I*B*a**2*d*f*exp(2*I*e))*exp(-4*I*f*x))*exp(-6*I*e)
/(64*a**4*f**2), Ne(64*a**4*f**2*exp(6*I*e), 0)), (x*(-(A*c - I*A*d - I*B*c - B*d)/(4*a**2) + (A*c*exp(4*I*e)
+ 2*A*c*exp(2*I*e) + A*c - I*A*d*exp(4*I*e) + I*A*d - I*B*c*exp(4*I*e) + I*B*c - B*d*exp(4*I*e) + 2*B*d*exp(2*
I*e) - B*d)*exp(-4*I*e)/(4*a**2)), True)) - x*(-A*c + I*A*d + I*B*c + B*d)/(4*a**2)

________________________________________________________________________________________